<?xml version="1.0" encoding="utf-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@page import="com.opensymphony.xwork2.util.ValueStack"%>
<%@page import="java.util.Set"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.Iterator"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<script type="text/javascript" src="<s:url value='/js/jquery-1.5.1.js'/>"></script>
	<title>出错啦</title>
	<script type="text/javascript">
		//setTimeout("javascript:location.href='<s:url value='/index.action'/>'", 5000);
		var isView = false;
		var time = 15;
		function timer(){
			$("#showTime").text(time);
			if (!isView) {  //只有不查看堆栈的时候才减，查看就不减了
				--time;
			}
			if (time < 0) {
				location.href="<s:url value='/index.action'/>";
			} else {
				setTimeout("timer()",1000);
			}
		}
		
		$(function(){
			setTimeout("timer()",1000); //定时
			$("#viewExceptionStackButton").toggle(function(){
					$(this).val("关闭异常堆栈");
					$("#exceptionStack").show();
					isView = true;
				},function(){
					$(this).val("查看异常堆栈");
					$("#exceptionStack").hide();
					isView = false;
			});
		});
	</script>
</head>
<body>
	<p><h2>系统发生异常</h2></p>
	<p>异常信息为：</p>
	<p style="color:#696969"><s:property  value="exception.message"/></p>
	<p>请确认你访问的地址是否正确，如果访问受限资源请登录后重试。</p>
	<p>
		<span id="showTime" style="color:red">15</span>秒钟后自动返回系统首页，
		如果不能自动跳转请手动<a href='<s:url value='/index.action'/>'>跳转</a>
	</p>

	<p><input id="viewExceptionStackButton" type="button" value="查看异常堆栈" /></p>
	<div id="exceptionStack" style="width:960px;height:600px;display:none;border:1px solid #ccc;overflow:auto;font-size:12px;">
		<s:property value="exceptionStack"/>
	</div>
<%
    ValueStack vs = (ValueStack)request.getAttribute("struts.valueStack");
    ((Exception)vs.findValue("exception")).printStackTrace();
%>
</body>
</html>